(proced-after-send-signal-hook): Use defcustom.
authorRoland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Sat, 7 Feb 2009 17:06:26 +0000 (17:06 +0000)
committerRoland Winkler <Roland.Winkler@physik.uni-erlangen.de>
Sat, 7 Feb 2009 17:06:26 +0000 (17:06 +0000)
(proced-header-line): Handle header lines that are shorter than
window-hscroll.
(proced-send-signal): Rebind split-width-threshold analogous to
dired-pop-to-buffer.

lisp/proced.el

index c6ce2034e0e1ee0895ea57b4ffa6bd90b12d3a58..fc4d6d01cf9d17f196ab05a90611cea8303286fd 100644 (file)
@@ -356,6 +356,13 @@ May be used to adapt the window size via `fit-window-to-buffer'."
   :options '(fit-window-to-buffer)
   :group 'proced)
 
+(defcustom proced-after-send-signal-hook nil
+  "Normal hook run after sending a signal to processes by `proced-send-signal'.
+May be used to revert the process listing."
+  :type 'hook
+  :options '(proced-revert)
+  :group 'proced)
+
 ;; Internal variables
 
 (defvar proced-available (not (null (list-system-processes)))
@@ -585,8 +592,10 @@ Important: the match ends just after the marker.")
 (defun proced-header-line ()
   "Return header line for Proced buffer."
   (list (propertize " " 'display '(space :align-to 0))
-        (replace-regexp-in-string ;; preserve text properties
-         "\\(%\\)" "\\1\\1" (substring proced-header-line (window-hscroll)))))
+        (if (<= (window-hscroll) (length proced-header-line))
+            (replace-regexp-in-string ;; preserve text properties
+             "\\(%\\)" "\\1\\1"
+             (substring proced-header-line (window-hscroll))))))
 
 (defun proced-pid-at-point ()
   "Return pid of system process at point.
@@ -1711,7 +1720,10 @@ After sending the signal, this command runs the normal hook
           (dolist (process process-alist)
             (insert "  " (cdr process) "\n"))
           (save-window-excursion
-            (pop-to-buffer (current-buffer))
+            ;; Analogous to `dired-pop-to-buffer'
+            ;; Don't split window horizontally.  (Bug#1806)
+            (let (split-width-threshold)
+              (pop-to-buffer (current-buffer)))
             (fit-window-to-buffer (get-buffer-window) nil 1)
             (let* ((completion-ignore-case t)
                    (pnum (if (= 1 (length process-alist))